package com.sfh.cp.msg;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sfh.cp.base.RefreshRecyleFragment;
import com.sfh.cp.msg.pst.IPstMessage;
import com.sfh.lib.mvp.IPresenter;
import com.sfh.lib.mvp.service.LoaderService;

import crm.sfh.server.entity.ENotice;
import crm.sfh.server.entity.rsp.TPage;

/**
 * Created by Administrator on 2018/3/7.
 */

public class MsgFragment extends RefreshRecyleFragment implements IPstMessage.IVMessage {
    @Override
    public BaseQuickAdapter createAdapter() {
        return new MessageAdapter();
    }

    IPstMessage pstMessage;

    @Override
    public boolean loadMore() {
        return true;
    }

    @Override
    public void onRefreshUI() {

    }

    @Nullable
    @Override
    public IPresenter getPresenter() {

        if (pstMessage == null) {
            pstMessage = LoaderService.getService(IPstMessage.class);
        }
        return pstMessage;
    }

    @Override
    public void onSuccess(TPage<ENotice> page) {
        success(page);
    }

    @Override
    public void onError(String error) {
        error("", error);
    }
}
